﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LIMS.Web
{
    public partial class AdmMessageManage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rpMessage.DataSource = BLL.MessageManager.SearchMessage(null);
                rpMessage.DataBind();
            }
        }

        protected String StuIdToName(string mesID)
        {
            return String.IsNullOrWhiteSpace(mesID) ? "" : BLL.MessageManager.GetStuNameByMesID(mesID);
        }
        protected String StatusCodeToWords(object mesStatus)
        {
            if (mesStatus == null || String.IsNullOrWhiteSpace(mesStatus.ToString()))
            {
                return "未处理";
            }
            return mesStatus.ToString() == "1" ? "已回复" : "未处理";
        }
        protected String adminIdToName(object mesAdminID)
        {
            if (mesAdminID == null || String.IsNullOrWhiteSpace(mesAdminID.ToString()))
            {
                return "";
            }
            return BLL.AdminManager.GetAdmNameByID(mesAdminID.ToString());
        }
        /// <summary>
        /// 字符串截取
        /// </summary>
        /// <param name="strInput">需要截断的字符串</param>
        /// <param name="nLength">截断字符串的长度</param>
        /// <returns></returns>
        protected string SubString(object objInput, int nLength)
        {
            if (objInput == null || String.IsNullOrWhiteSpace(objInput.ToString()))
            {
                return "";
            }
            return objInput.ToString().Length <= nLength ? objInput.ToString() : objInput.ToString().Substring(0, nLength) + "…";
        }

        protected void ddlMessageStatus_SelectedIndexChanged(object sender, EventArgs e)
        {
            rpMessage.DataSource = BLL.MessageManager.SearchMessage(ddlMessageStatus.SelectedValue);
            rpMessage.DataBind();
        }


    }
}